-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[api] delete file #1122
base: main
Are you sure you want to change the base?
[api] delete file #1122
Conversation
b31bc38
to
446a1ff
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job. I have only some minor comments
Great comments @kostas-kou ! Fixed most of them in 92903a6, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! Especially on the tests, very extensive.
I don't have any significant remark on the PR.
353261a
to
3ac7e5e
Compare
@kostas-kou and @pahatz, thanks for your reviews! I have fixed the weird comment, rebased on main and also rebased to get rid of the fixup-commits. Only 3ac7e5e is new, the rest is the same as when you reviewed. |
...and added 8a745c4 for the rbac |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't tested, but it looks good. Tiny minor comments :-)
8a745c4
to
0f445c8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More specific comments are coming
109e7e2
to
d690e54
Compare
Co-authored-by: Joakim Bygdell <[email protected]>
0fa47f5
to
50367ef
Compare
Updated, fixed, rebased etc. Please re-review. |
fc94088
to
ebce118
Compare
2dd0e1b
to
4821ce0
Compare
"submission_user= $1 and id = $2 " + | ||
"AND EXISTS (SELECT 1 FROM " + | ||
"(SELECT event from sda.file_event_log where file_id = $2 order by started_at desc limit 1) " + | ||
"as subquery WHERE event = 'uploaded')" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this condition, the first retrieved query will has the event status error
for files with fileStatus = error
. In this case, no filepath will be returned. And therefore, finally get the error File could not be found in inbox
when trying to delete a file with status error
.
In fact, only files with the status uploaded
can be deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, @MalinAhlberg. I do have one question regarding which types of files can be deleted. If I understand correctly, we decided that all files that are not archived can be deleted. However, in the current setup, it seems that only files with the uploaded
fileStatus can be deleted. Please see my inline comment for further clarification.
Related issue(s) and PR(s)
This PR closes #1134 .
Description
This PR adds the delete file functionality to the
api
component. Specifically, it deletes the file from the inbox and it adds a new file log event, setting the file status todisabled
.Also, it adds the
fileID
to thelist
functionality of theapi
, since that field is needed in order to delete a file:How to test
make build-all
thenPR_NUMBER=$(date +%F) docker compose -f .github/integration/sda-s3-integration.yml run integration_test
.List the files (eg with
http://localhost:8090/users/[email protected]/files
) and make sure files in the inbox can be deleted, and that archived files can not be deleted.